//
// Created by lenovo on 24-12-30.
//
using namespace std;
#include <vector>

class Solution2
{
public:
    static int singleNumber(vector<int>& nums)
    {
        int ret = 0;
        for(int i=0; i<32; i++)
        {
            int count = 0;
            for(int num : nums)
            {
                if((num>>i & 1) == 1)
                {
                    count++;
                }
            }
            if(count % 3 != 0)
            {
                ret = ret | 1<<i;
            }
        }
        return ret;
    }
};